//go:build ignore

// 有一个数组 [1,4,9,16,2,5,10,15]，生成一个新切片，要求新切片元素是数组相邻2项的和

package main

import (
	"fmt"
)

func main() {
	a := []uint8{1, 4, 9, 16, 2, 5, 10, 15}
	b := make([]uint8, len(a)-1)
	for i := 1; i < len(a); i++ {
		b[i-1] = a[i] + a[i-1]
	} // b = [5 13 25 18 7 15 25]
	fmt.Printf("[a] %p %p len=%d cap=%d %+v\n", &a, &a[0], len(a), cap(a), a)
	fmt.Printf("[a] %p %p len=%d cap=%d %+v\n", &b, &b[0], len(b), cap(b), b)
}
